<?php

/**
 * CelebrioGallery
 *
 * @copyright  Copyright (c) 2011 Celebrio Software
 * @package    CelebrioPeople
 */
namespace ApplicationsModule\GalleryModule;

use \Nette\Object;
use Celebrio\AccessControl\UserManagement;
use Nette\Environment;

use Celebrio\Core\IModuleInit;
use Celebrio\Core\DummyInit;
use Celebrio\Core\ServiceProvider;
use Celebrio\FileSystem\File;

use Celebrio\Modules;

/**
 * Gallery module initialization. Makes basic Gallery folder and first gallery
 * named _("Default") and saves folder image for empty galleries.
 * 
 * @author honza
 */
class GalleryInit extends DummyInit implements IModuleInit {

    
    public function install(array $configuration) {
        $user = Environment::getUser();
        $fs = ServiceProvider::getService(Modules::FS);
        $defaultName = _("Default");
        $fs->save(
                "/usr/" . $user->getIdentity()->name . "/gallery/",
                null);
        /*$fs->save(
                "/usr/" . $user->getIdentity()->name . "/gallery/" . $defaultName, 
                null);*/
        //$emptyFolderURL = \WWW_DIR . "/systemApps/celebriogallery/images/folder.png";
        
        //$file = new File($emptyFolderURL, "r");
        //$fs->save(Gallery::EMPTY_FOLDER, $file->getContents());
        //$file->closeFile();
    }

}